package com.example.fx

import androidx.appcompat.app.AppCompatActivity
import android.os.Bundle
import androidx.navigation.fragment.NavHostFragment
import androidx.navigation.ui.setupWithNavController
import com.alibaba.android.arouter.facade.annotation.Autowired
import com.alibaba.android.arouter.facade.annotation.Route
import com.alibaba.android.arouter.launcher.ARouter
import com.example.base.mvvm.BaseViewActivity
import com.example.fx.databinding.ActivityMainBinding
@Route(path = "/app/MainActivity")
class MainActivity : BaseViewActivity<ActivityMainBinding>() {
    @Autowired
    @JvmField
    var index = 0
    override fun getLayout(): Int  = R.layout.activity_main

    override fun initView() {
        ARouter.getInstance().inject(this)
        val navHostFragment = supportFragmentManager.findFragmentById(R.id.fragmentContainerView) as NavHostFragment
        val navController = navHostFragment.navController
        binding.bnv.setupWithNavController(navController)
        when (index){
            0->{
                binding.bnv.selectedItemId = R.id.indexFragment
            }
            1->{
                binding.bnv.selectedItemId = R.id.cateFragment
            }
            2->{
                binding.bnv.selectedItemId = R.id.carFragment
            }
            3->{
                binding.bnv.selectedItemId = R.id.mineFragment
            }
        }
    }

    override fun initData() {

    }

}